import { http } from "@/plugin/http";

// Banner
export const getBanner = async () => {
  try {
    const result = await http.post<API.Home.BannerResult>("/home/banner", {});
    return result?.image_list || [];
  } catch (error) {
    return [];
  }
};

// 底部信息
export const getBottomInfo = async () => {
  try {
    return await http.post<API.Home.BottomInfoResult>("/home/bottom", {});
  } catch (error) {
    return null;
  }
};

// Live-Open
export const getLiveOpen = async () => {
  try {
    const result = await http.post<API.Home.LiveOpenResult>(
      "/home/live-open",
      {}
    );
    return result.list || [];
  } catch (error) {
    return [];
  }
};

export const getHotBoxAndForge = async (
  params: API.Home.HotBoxAndForgeParams
) => {
  try {
    return await http.post<API.Home.HotBoxAndForgeResult>(
      "/home/host-list",
      params
    );
  } catch (error) {
    return null;
  }
};
